package me.tuyou.jvm.oom;

//-Xss128K -XX:+PrintGCDetails
//-XX:HeapDumpOnOutOfMemoryError
/**
 * 栈属于线程私有，所以报错的时候会报属于哪个线程
 * @author：涂有
 * @date 2017年6月28日 下午2:15:24
 */
public class StackOverFlow {

	private static int count = 0;
	
	public static void count(){
		System.out.println(count++);
		count();
	}
	
	public static void main(String[] args) {
		count();

//		Exception in thread "main" java.lang.StackOverflowError
//		at sun.nio.cs.UTF_8$Encoder.encodeLoop(UTF_8.java:691)
//		at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:579)
//		at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:271)
//		at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
//		at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
//		at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
//		at java.io.PrintStream.write(PrintStream.java:526)
//		at java.io.PrintStream.print(PrintStream.java:597)
//		at java.io.PrintStream.println(PrintStream.java:736)
//		at me.tuyou.jvm.oom.StackOverFlow.count(StackOverFlow.java:15)
//		at me.tuyou.jvm.oom.StackOverFlow.count(StackOverFlow.java:16)
//		at me.tuyou.jvm.oom.StackOverFlow.count(StackOverFlow.java:16)
	}
}
